//
//  dbAccess.h
//  MoneyLog
//
//  Created by Max on 11-3-9.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@class Database;
@class RecordWrapper;
@class KindWrapper;
@class PieChartItem;
@class AccountWrapper;

extern Database *g_Database;

@interface Database : NSObject {

}

-(void)close;

//Record Table
-(NSArray *) getRecord:(NSString *)strWhere;
-(NSMutableArray *) getRecordArray:(NSString *)strWhere;
-(NSMutableArray *) getRecordArrayBySql:(NSString *)sql;
-(bool)recordAdd:(RecordWrapper *) record;
-(bool)recordDelete:(NSInteger)recordId;
-(bool)recordUpdate:(RecordWrapper *) record;

//Record Type table
-(NSMutableArray *) getRecordTypeArray;

//Kind Table
-(NSMutableArray *) getKind:(NSString *)strWhere;
-(NSMutableArray *) getCommonKind:(int)count;
-(NSMutableArray *) getMarkKind;
-(bool)updateKind:(KindWrapper *)kind;

//Account Table
-(NSMutableArray *) getAccountArray:(NSString *)strWhere;
-(bool)accountAdd:(AccountWrapper *) account;
-(bool)accountDelete:(NSInteger)accountId;

//Account Type Table
-(NSMutableArray *) getAccountTypeArray;


@end
